package darksideoftheloom;
/**
 * Submission.java
 * @Auther Joshua Warner
 * @Version 1.0
 * @Date February 16, 2013
 * Purpose: To hold data that represents a submission for 
 *          a WeavingDraft
 */


public class Submission implements Comparable{
    /*
     * Attributes
     */    

    private final String my_user_name;
    private final String my_design_name;
    private final String my_catagory;
    private final WeavingDraft my_draft;


    /*
     * methods
     */

    /**
     * Constructor
     *
     * Creates a new submittion that has the following attributes.
     *
     * @Param user_name The name of the user submitting the draft.
     * @Param draft_name the name of the draft that is being submitted.
     * @Param catagory The catagory of the compatition that the 
     *           submittion falls under.
     * @Param draft The draft that is being submitted.
     */
    public Submission(String user_name, String design_name,
                      String catagory, WeavingDraft draft){
        my_user_name = user_name;
        my_design_name = design_name;
        my_catagory = catagory;
        my_draft = draft;
    }


    /*
     * getters
     */
    public String getUserName(){
        return my_user_name;
    }
    
    public String getDesignName(){
        return my_design_name;
    }

    public String getCategory(){
        return my_catagory;
    }

    public WeavingDraft getWeavingDraft(){
        return my_draft;
    }

    /**
     * Sorts submissions based on there category.
     * 
     * @author Michael Wamsley
     * @param o1 
     * 		an object
     * @return integer
     */
	@Override
	public int compareTo(final Object o1) {
		return this.my_catagory.compareToIgnoreCase(((Submission) o1).my_catagory);
	}
}